<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <input type="text" value="北京市" class="nr1">
    <input type="text" value="招远市" class="nr2">
    <button class="but">传输</button>
</body>
</html>
<script>
    var but=document.querySelector(".but")
    var nr1=document.querySelector(".nr1")
    var nr2=document.querySelector(".nr2")
    but.onclick=function(){
        alert(nr1)
        alert(nr2)
    }
</script>